<template>
  <el-dialog :model-value="dialogVisible" title="适用范围选择" width="800px" :before-close="handleClose" append-to-body custom-class="scope-dialog">
  <OrgWorkPeople ref="orgRef" :scopeInfo="scopeInfo" @on-update="updateData" @handleClose="handleClose" v-if="dialogVisible"></OrgWorkPeople>
  <template #footer>
  <span class="dialog-footer">
        <el-button @click="handleClose">取消</el-button>
        <el-button type="primary" @click="submit()">确定</el-button>
  </span>
</template>
  </el-dialog>
</template>
<script setup>
import OrgWorkPeople from '@/components/OrgWorkPeople/index.vue'

const props = defineProps({
  dialogVisible: {
    type: Boolean,
    default: false,
  },
  scopeInfo: {
    type: Object,
    default: () => {},
  },
});

const orgRef = ref(null)

const emit = defineEmits(["handleClose", "on-update"]);
const updateData = (data)=>{
  console.log(data)
  emit('handleClose')
  emit("on-update", [...data]);
}
const handleClose = ()=>{
  emit('handleClose')
}
const submit = ()=>{
  orgRef.value.submit()

}

</script>

<style >
.scope-dialog .el-dialog__body {
  margin-bottom: 0;
  padding-bottom: 0;
}
</style>
